Skip to main content

All Questions

Tagged with
0votes
3answers
196views

How to edit a string matching a pattern in a specific field on the condition another string is not present on the same line

I need to edit the string "NA" to "Na" only if it is in the 6th field of a file. I can currently achieve this with: awk '{gsub("NA","Na",$6)}1' $filename ...
CPC_92's user avatar
1vote
1answer
72views

Sed - replace a string with a character of another line

I am trying to write a script to reformat some text. pages: page1: gui-rows: 6 items: '6': material: CAT_SPAWN_EGG buy: 999999999 sell: -1 '7': ...
Pegoku's user avatar
1vote
5answers
146views

Add two delimiters after every sixth comma

I'm trying to expand on this question but can't figure out this issue: Let's say I've got a file roll.txt: echo "'123456789','987651234','129873645','213456789','987612345','543216789','432156789'...
jophuh's user avatar
3votes
2answers
341views

How to Replace Multiple Lines using Files on Termux

Assume I have many *.txt files on directory texts with the below contents. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam tincidunt mauris eu risus. Vestibulum auctor dapibus neque. ...
zakadmin's user avatar
3votes
2answers
204views

Indent Fortran source code, propagate indentation down to unindented special lines

I'm trying to write my own script to improve some auto-formatting before commiting to a remote repository. I use indenting guides in my IDE and the autoformatters available for my language (FORTRAN) ...
Philip Moloney's user avatar
0votes
3answers
78views

Add custom delimiter in key-value pair

I have data which are in "Key:value" form (901 S 902 M 905 F 906 WAPENC 907 31 908 371 909 38765469947/TYPE=PLMN and so on ) where keys are 901,902,905,906.....so on and respective values ...
Sunny's user avatar
2votes
2answers
129views

Add custom delimiter in key-value form data

I have data which are in "Key:value" form where keys are 901,902,903,904 and respective values are S,M,F,WAP`, with space as delimiter. Input example 901 S 902 M 903 F 904 WAP ..... I want ...
Sunny's user avatar
1vote
3answers
288views

text processing rows to columns for a block of lines Awk

i have input file like below .i need to reformat the text as o/p mentioned. I using the awk got from this forum but it is displayed based on the List A columns count. Please help awk 'BEGIN{ max=0 } ...
Renga's user avatar
2votes
2answers
340views

Remove empty lines in tab delimited file while preserving row labels

I have a tab delimited file with column headers like ID, A, B, C, D as shown in the pic below, and row labels too like a, b, c, d, e show below in pic. How do I remove all the empty lines (rows) while ...
Ben M's user avatar
1vote
3answers
1kviews

Insert character in middle of string

I would like to perform adding hyphen "-" character in my string. How would like to perform? vol0802-f522-6cc63-0a3-d I am getting the above about output. However, I need the following ...
Sandeep K's user avatar
3votes
6answers
1kviews

Splitting columns in TSV into CSV

I have a TSV file with two columns in the format of id1\tcol1,col2,col3 id2\tcol4,col5 I want to split the second column in combination with the first column to output id1,col1 id1,col2 id1,col3 id2,...
Googlebot's user avatar
3votes
1answer
303views

align data by word into column

How can I align data into pretty columns relative to given word? For example, I have output of the route -n command: default via 172.20.99.254 dev eth0 87.33.17.71 dev tun0 scope link 89.223.15.12 ...
Martin Vegter's user avatar
1vote
4answers
570views

Split the line into next line after a matching pattern

In the input file shown below, I am trying to find the string job_type and move the it to the next line if it matches job_type. I tried this, but it is not working: sed "s/[A-Z][a-z]*job_type:/\...
Renga's user avatar
5votes
5answers
1kviews

If column has multiple values, copy line with each value separately

I have a file with the following format, each column separated by tabs: C1 C2 C3 a b,c d e f,g,h i j k l ... Now I need to have the number of lines according to the number of values ...
schrodingerscatcuriosity's user avatar
1vote
1answer
4kviews

How can sed replacement string be a command's output?

Below sed command helps add text Hello to the end of each line of the input <complex_query> | sed "s,$,Hello," Output: myvar1: Hello myvar2: Hello I now wish to have the output of ...
Ashar's user avatar

153050per page
close